<form class="layui-form w700 js-view-admin-config" method="post" action="{:U('Site/saveConfig')}" lay-label-w100 lay-filter="admin-config">
    <div class="layui-form-item">
        <label class="layui-form-label">升级提醒</label>
        <div class="layui-input-block">
            <input type="checkbox" name="admin[popup_upgrade]" lay-skin="switch" lay-text="开启|关闭" value="1" {$admin['popup_upgrade']?'checked':''} unvalue="0"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机站域名</label>
        <div class="layui-input-block">
            <input type="text" name="admin[wap_domain]" value="{$admin.wap_domain|default=''}" placeholder="请输手机站域名" autocomplete="off" class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item hide">
        <label class="layui-form-label">启用https</label>
        <div class="layui-input-block">
            <input type="checkbox" name="admin[is_https]" lay-skin="switch" lay-text="开启|关闭" value="1" {$admin['is_https']?'checked':''} unvalue="0"/>
            <p class="mt10 cl-888 f12">开启前，请先在空间正确配置SSL证书。<br>在能正常访问https://域名的情况下，才开启这个功能，使整站的URL都强制采用https协议访问。</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">后台路径</label>
        <div class="layui-input-block flex">
            <label class="lh38 f16 cl-666">{:U('/',[],false,true)}</label>
            <input  class="layui-input w100 ml5" type="text" name="admin[app_map]"  value="{$admin.app_map|default='admin'}"  autocomplete="off" onkeyup="this.value=this.value.replace(/[^a-zA-Z]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\[^a-zA-Z]/g,''));"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">后台LOGO</label>
        <div class="layui-input-block">
            {imgspace name="admin[logo]" value="$admin.logo|default=''" title="后台LOGO" /}
        </div>
    </div>
    <div class="layui-form-item hide">
        <label class="layui-form-label">数据备份路径</label>
        <div class="layui-input-block">
            <input type="text" name="admin[sqldatapath]" value="{$admin.sqldatapath|default=''}" placeholder="数据备份路径" autocomplete="off" class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">后台登录超时</label>
        <div class="layui-input-block flex">
            <input type="text" name="admin[expiretime]"  value="{$admin.expiretime|default='3600'}" placeholder="后台登录超时" lay-verify="number" autocomplete="off" class="layui-input w200"/>
            <label class="lh38">(秒)</label>
            <div class="flex-c ml5">
                <i class="layui-icon layui-icon-tips" lay-tips="默认3600秒等于1小时"></i>
            </div>
        </div>
    </div>
    <div class="layui-form-item js-inlet">
        <label class="layui-form-label">去除index.php</label>
        <div class="layui-input-block">
            <input type="checkbox" name="admin[inlet]" lay-filter="admin-config-inlet" lay-skin="switch" lay-text="开启|关闭" value="1" {$admin['inlet']?'checked':''} unvalue="0"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">隐藏插件菜单</label>
        <div class="layui-input-block">
            <input type="checkbox" name="admin[hide_plugin]" lay-skin="switch" lay-text="开启|关闭" value="1" {$admin['hide_plugin']?'checked':''} unvalue="0"/>
        </div>
    </div>

    <div class="layui-form-item mt30">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
        </div>
    </div>
</form>
<script>
    (function () {
        var $view = $('.js-view-admin-config');
        var root = '{:getRootUrl()}';
        layui.form.on('switch(admin-config-inlet)', function (data) {
            if (data.elem.checked) {
                layer.open({
                    type: 2,
                    title: false,
                    area: ['0px', '0px'],
                    shade: 0.0,
                    closeBtn: 0,
                    shadeClose: true,
                    content: root + '{:getAppName("admin")}/Login/setInlet.html',
                    success: function (layero, index) {
                        layer.close(index);
                        var body = layer.getChildFrame('body', index);
                        var content = body.html();
                        if (content.indexOf("passing") == -1) {
                            $('[name="admin[inlet]"]', $view).prop('checked', false);
                            layui.form.render('checkbox', 'admin-config');
                            layer.alert('不支持去除index.php，请<a class="cl-38f" href="http://www.rrzcms.com/Admin/News/info/id/14.html" target="_blank">点击查看教程</a>', {
                                icon: 2,
                                title: false
                            });
                        }
                    }
                });
            }
        });

        function checkInlet() {
            layer.open({
                type: 2,
                title: false,
                area: ['0px', '0px'],
                shade: 0.0,
                closeBtn: 0,
                shadeClose: true,
                content: root + '{:getAppName("admin")}/Login/setInlet.html',
                success: function (layero, index) {
                    layer.close(index);
                    var body = layer.getChildFrame('body', index);
                    var content = body.html();
                    if (content.indexOf("passing") == -1) {
                        $('[name="admin[inlet]"]', $view).prop('checked', false);
                        $.post(root + 'index.php/{:getAppName("admin")}/Login/setInlet', { inlet: 2 });
                        $('.js-inlet', $view).show();
                    } else {
                        $('[name="admin[inlet]"]', $view).prop('checked', true);
                        $('.js-inlet', $view).hide();
                    }
                    layui.form.render('checkbox', 'admin-config');
                }
            });
        }
        checkInlet();
    })();
</script>